package com.buanalintas.sandals.pos.entities;

import com.buanalintas.bynga.formatter.MoneyFormatter;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

@Entity
@Table(name = "pos_master_price_gross")
@XmlRootElement
//@NamedQueries({
//    @NamedQuery(name = "PosMasterPriceGross.findAll", query = "SELECT t FROM PosMasterPriceGross t"),
//    @NamedQuery(name = "PosMasterPriceGross.findBySync", query = "SELECT t FROM PosMasterPriceGross t WHERE t.sync = :sync"),
//    @NamedQuery(name = "PosMasterPriceGross.findByPriceGrossId", query = "SELECT t FROM PosMasterPriceGross t WHERE t.priceGrossId = :priceGrossId"),
//    @NamedQuery(name = "PosMasterPriceGross.findByPriceGrossForm", query = "SELECT t FROM PosMasterPriceGross t WHERE t.priceGrossForm = :priceGrossForm")
//})
public class PosMasterPriceGross implements Serializable {
    @OneToMany(mappedBy = "itemPriceGrossId")
    private Collection<PosMasterItem> posMasterItemCollection;

    private static final long serialVersionUID = 1L;
    @Column(name = "sync")
    private String sync;
    @Id
    @Basic(optional = false)
    @Column(name = "price_gross_id")
    private Integer priceGrossId;
    @Basic(optional = false)
    @Column(name = "price_gross_value")
    private BigDecimal priceGrossValue;
    @Basic(optional = false)
    @Column(name = "price_gross_quantity")
    private Integer priceGrossQuantity;
    @Column(name = "price_gross_name")
    private String priceGrossName;

    public PosMasterPriceGross() {
    }

    public Integer getPriceGrossId() {
        return priceGrossId;
    }

    public void setPriceGrossId(Integer priceGrossId) {
        this.priceGrossId = priceGrossId;
    }

    public BigDecimal getPriceGrossValue() {
        return priceGrossValue;
    }

    public void setPriceGrossValue(BigDecimal priceGrossValue) {
        this.priceGrossValue = priceGrossValue;
    }

    public String getSync() {
        return sync;
    }

    public void setSync(String sync) {
        this.sync = sync;
    }

    public String getPriceGrossName() {
        return priceGrossName;
    }

    public void setPriceGrossName(String priceGrossName) {
        this.priceGrossName = priceGrossName;
    }

    public Integer getPriceGrossQuantity() {
        return priceGrossQuantity;
    }

    public void setPriceGrossQuantity(Integer priceGrossQuantity) {
        this.priceGrossQuantity = priceGrossQuantity;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (priceGrossId != null ? priceGrossId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof PosMasterPriceGross)) {
            return false;
        }
        PosMasterPriceGross other = (PosMasterPriceGross) object;
        if ((this.priceGrossId == null && other.priceGrossId != null) || (this.priceGrossId != null && !this.priceGrossId.equals(other.priceGrossId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return MoneyFormatter.getInstance().format(priceGrossValue);

    }

    @XmlTransient
    public Collection<PosMasterItem> getPosMasterItemCollection() {
        return posMasterItemCollection;
    }

    public void setPosMasterItemCollection(Collection<PosMasterItem> posMasterItemCollection) {
        this.posMasterItemCollection = posMasterItemCollection;
    }
}
